package com.neusoft.yiyang.common.entity.bed.vto;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.neusoft.yiyang.common.entity.bed.Bed;
import com.neusoft.yiyang.common.entity.customer.Customer;
import com.neusoft.yiyang.common.enums.BedStatus;
import com.neusoft.yiyang.common.enums.BloodType;
import com.neusoft.yiyang.common.enums.Gender;
import lombok.Data;

import java.util.Date;

@Data
public class BedCustomer {
    private Integer buildingNo; // 楼栋号
    private Integer floor; // 楼层
    private String roomNumber; // 房间号
    private Integer bedNo; // 床号
    private BedStatus status; // 床位状态，使用枚举类型
    private Integer customerId;  // 客户ID
    private String customerName; // 客户姓名
    private Gender gender;       // 性别（使用枚举：M/F）
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date birthDate;      // 出生日期（使用Date类型，数据库中为DATE）
    private String idCard;       // 身份证号
    private BloodType bloodType; // 血型（使用枚举：A/B/AB/O/Other）
    private String familyName;   // 家属姓名
    private String familyPhone;  // 家属电话
    private Integer caretakerId; // 健康管家ID（关联用户表）
    private Integer careLevelId; // 护理级别ID
    private Integer bedId;       // 床位ID
    private Integer dietTagId;   // 饮食标签ID
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date checkInDate;    // 入住日期（使用Date类型，数据库中为DATE）
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date contractEndDate; // 合同到期日期（使用Date类型，数据库中为DATE）
    private Integer customerType; // 1 表示护理老人，0 表示自理老人

    public BedCustomer(Bed bed, Customer customer) {
        this.buildingNo = bed.getBuildingNo();
        this.floor = bed.getFloor();
        this.roomNumber = bed.getRoomNumber();
        this.bedNo = bed.getBedNo();
        this.status = bed.getStatus();
        this.customerId = customer.getCustomerId();
        this.customerName = customer.getCustomerName();
        this.gender = customer.getGender();
        this.birthDate = customer.getBirthDate();
        this.idCard = customer.getIdCard();
        this.bloodType = customer.getBloodType();
        this.familyName = customer.getFamilyName();
        this.familyPhone = customer.getFamilyPhone();
        this.caretakerId = customer.getCaretakerId();
        this.careLevelId = customer.getCareLevelId();
        this.bedId = customer.getBedId();
        this.dietTagId = customer.getDietTagId();
        this.checkInDate = customer.getCheckInDate();
        this.contractEndDate = customer.getContractEndDate();
        this.customerType = customer.getCustomerType();
    }
}

